export function setStorage(key = 'token', value) {
	uni.setStorageSync(key, value)
}

export function getStorage(key = 'token') {
	return uni.getStorageSync(key)
}

export function removeStorage(key = 'token') {
	return uni.removeStorageSync(key)
}

export function checkLogin(){
    return getStorage('openId');
}

export function checkLocation(){
    return getStorage('currentLocation');
}

export function getTime() {
  return Math.round(new Date() / 1000);
}

export function getDomain(){
    return 'http://www.domain.com'; // 后端域名
}

export default class countDown {
	constructor() {
		this.count = 60
		this.timer = null
		this.backText = '获取验证码'
	}

	getDown(val) {

		return this.timer = setInterval(() => {

			this.count--

			if (this.count < 1) {
				clearInterval(this.timer)
				this.timer = null
				this.count = 60
				this.backText = `获取验证码`
				return
			}

			this.backText = `${this.count}秒后重新获取`

		}, 1000)

	}
}
